package com.lyx.server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyx.server.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * ⽤户表(User)表数据库访问层
 *
 * @author McMeloxD
 * @since 2024-08-12 17:56:02
 */
public interface UserDao extends BaseMapper<User> {

    @Update("update t_user set kickback=kickback+#{money},update_time=now() where id=#{id}")
    int updateKickback(@Param("money") double money, @Param("id") Integer id);

    @Update("update t_user set password=#{password} where phone=#{phone}")
    int updatePassword(@Param("password") String password,@Param("phone") String phone);

    @Update("update t_user set name=#{name} where phone=#{phone}")
    int updateNameByPhone(@Param("name") String name,@Param("phone") String phone);

    @Update("update t_user set s_days=#{day} where id=#{uid}")
    int updateSdaysByUid(@Param("uid") Integer uid,@Param("day") Integer day);

    @Update("update t_user set exp=exp+#{exp} where id=#{uid}")
    int updateExpByUid(@Param("exp")Integer exp, @Param("uid") int id);

    @Update("update t_user set level=#{level} where id=#{uid}")
    int updateLevelByUid(@Param("uid") int uid,@Param("level") String level);

}

